<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<link rel="stylesheet" href="${staticPath}/lib/ztree/3.5/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="${staticPath}/lib/ztree/3.5/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="${staticPath}/lib/ztree/3.5/js/jquery.ztree.excheck-3.5.js"></script>
<script type="text/javascript" src="${staticPath}/js/selectBerth.js"></script>

<script type="text/javascript">
	$(function() {
		$("#gcardDiscount").decimalinput();
		$("#gcardDiscount2").decimalinput();
		$("#ocardDiscount").decimalinput();
		$("#ocardDiscount2").decimalinput();
		var supplierNo =$("#supplierNo").attr("value");
// 		$("#brand").FillOptions(Com_Parameter.ContextPath+"/biz/contract/commonContract/ "+supplierNo+"/getBrandInfo",{datatype:"json",textfield:"name",valuefiled:"id",defValue:"${brand.brandId}"});
		var mechIds = $("#shopIds").val();				//获得添加的招商编号
		selectBerth(mechIds,Com_Parameter.ContextPath);	//将招商编号填充进商铺
		isMainBrand();		//处理主品牌只能选择一次
	});

	function chenageDeductCode(t, value) {
		if (value === "10" || value === "") {
			$("#gcardDiscount").attr("disabled", "disabled");
			$("#gcardDiscount2").attr("disabled", "disabled");
			$("#ocardDiscount").attr("disabled", "disabled");
			$("#ocardDiscount2").attr("disabled", "disabled");
			setBrandValue(Com_Parameter.ContextPath);
		} else if (value === "20") {
			$("#gcardDiscount").removeAttr("disabled");
			$("#gcardDiscount2").removeAttr("disabled");
			$("#ocardDiscount").removeAttr("disabled");
			$("#ocardDiscount2").removeAttr("disabled");
		}
	}
//-->
</script>
<div class="modal-dialog">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal"
				aria-hidden="true">&times;</button>
			<h4 class="modal-title">合同品牌信息添加</h4>
		</div>
		<!-- /modal-header -->
		<div class="modal-body">
			<table class="table">
				<tr>
					<td width="50%">
						<div class="col-sm-12">
							<label for="brand" class="col-sm-5 control-label">品牌:</label>
							<div class=" input-group col-sm-7">
<!-- 								<select id="brand" class="form-control"  -->
<%-- 									onchange="setBrandValue('${contextPath}')" > --%>
<!-- 									<option value="">--请选择---</option> -->
<!-- 								</select>  -->
								<ossp:select id="brand" class_="form-control" defaultSelected="${brandId}" service="SelectBrandService?supplierNo=${supplierNo}" onchange="setBrandValue('${contextPath}')" />
								
								<input type="hidden" id="brandId" value="${brand.brandId}">
								<input type="hidden" id="brandNo" value="${brand.brandNo}">
								<input type="hidden" id="brandCName" value="${brand.brandCName}">
								<input type="hidden" id="brandEName" value="${brand.brandEName}">
								<input type="hidden" id="brandLevel" value="${brand.brandLevel}">
								<input type="hidden" id="assbrand_id" value=""> <input
									type="hidden" id="operate" value="${operate}" /> <input
									type="hidden" id="barnd_seq" value="${num}" />
								<!-- 	品牌引进责任人 -->
								<input type="hidden" id="brandInviteHead"
									value="${brand.brandInviteHead}">
							</div>
						</div>
					</td>
					<td >
						<div class="col-sm-12">
							<label for="brandAttribute_lab" class="col-sm-5 control-label">品牌属性:</label>
							<div class=" col-sm-7">
								<ossp:select class_="form-control"
									defaultSelected="${brand.brandAttribute}" id="brandAttribute"
									dictType="BRAND_ATTRIBUTE"></ossp:select>
							</div>
						</div>
					</td>
				</tr>

				<tr width="50%">
					<td>
						<div class="col-sm-12">
							<label for="updateBy" class="col-sm-5 control-label">招商分类:</label>
							<div class=" input-group col-sm-7">
								<input type="hidden" id='inviteCate' value="${cmcCate.cateNo}" /> 
							<input type="hidden" id='commodityCate' /> 
							<input type="text" class="form-control" id="inviteCateName"
									value="${cmcCate.cateName}" placeholder="招商分类"
									readonly="readonly" class="form-control required">
							</div>
						</div>
					</td>
					<td>
						<div class="col-sm-12">
							<label for="shop_lab" class="col-sm-5 control-label">商铺:</label>
							<input type="hidden" id="assShopIds" name="assShopIds">
							<div class=" input-group col-sm-7" id="selectBerthDiv">
								<input type="text" class="form-control" id="shopName"
									placeholder="商铺信息" readonly="readonly"
									class="form-control required"> <span
									class="input-group-btn">
									<button class="btn btn-primary" 
										type="button" onclick="showMenu(); return false;">选择</button>
								</span>
							</div>
						</div>
					</td>
				</tr>


				<tr width="50%">
					<td>
						<div class="col-sm-12">
							<label for="mainBrand_lab" class="col-sm-5 control-label">主品牌:</label>
							<div class=" input-group col-sm-7">
								<ossp:select id="mainBarnd" defaultSelected="${brand.mainBarnd}"
									class_="form-control" dictType="MAIN_BRAND"></ossp:select>
							</div>
						</div>

					</td>
					<td>
						<div class="col-sm-12">
							<label for="memberRateType_lab" class="col-sm-5 control-label">会员卡类型:</label>
							<div class=" input-group col-sm-7">
								<ossp:select defaultSelected="${brand.memberRateType}"
									onchange="chenageDeductCode(this,this.options[this.options.selectedIndex].value)"
									dictType="ONTRACT_MEMBER_RATE_" id="memberRateType"
									class_="form-control"></ossp:select>
							</div>
						</div>
					</td>
				</tr>

				<tr>
					<td>
						<div class="col-sm-12">
							
							<input type="hidden" id="gcardDiscount2" value="${brand.ocardDiscount2}" disabled="disabled" class="form-control" />
							<input type="hidden" id="ocardDiscount2" value="${brand.ocardDiscount2}" disabled="disabled" class="form-control" />
							<input type="hidden" id='purchasingGroup' value="${cmcCate2.id}" />
							<label for="gcardDiscount_lab" class="col-sm-5 control-label">金卡折率
								:</label>
							<div class=" input-group col-sm-7">
								<input id="gcardDiscount" disabled="disabled" value="<fmt:formatNumber value="${brand.gcardDiscount}" pattern="0.00#"/>"  class="form-control" /> 
								<span class="input-group-addon"></span>
							</div>
						</div>
					</td>

					<td>
						<div class="col-sm-12">
							<label for="gcardDiscount_lab" class="col-sm-5 control-label">普卡折率
								:</label>
							<div class=" input-group col-sm-7">
									<input   id="ocardDiscount" value="<fmt:formatNumber value="${brand.ocardDiscount}" pattern="0.00#"/>" disabled="disabled" class="form-control" />
								<span class="input-group-addon"></span>
							</div>
						</div>
					</td>
				</tr>

				<tr>
					<td>
						<div class="col-sm-12">
							<label for="gcardDiscount_lab" class="col-sm-5 control-label">是否折上折:</label>
							<div class=" input-group col-sm-7">
								<ossp:radio dictType="IS_ZS" defaultChecked="0" value="${iszs}" name="is_zs" id="is_zs"></ossp:radio> 
							</div>
						</div>
					</td>
				</tr>
			</table>

		</div>
		<!-- /modal-body -->
		<div class="modal-footer">
			<button type="button" id="ok2" onclick="btnBrandOk_click()"
				class="btn btn-primary">确定</button>
			<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		</div>
		<!-- /modal-footer -->
	</div>
	<!-- /modal-content -->
	<div id="menuContent" class="menuContent"
		style="display: none; position: absolute;">
		<ul id="treeDemo" class="ztree"
			style="margin-top: 10px;border: 1px solid #617775;background: #f0f6e4;width:220px;height:360px;overflow-y:scroll;overflow-x:auto;"></ul>
	</div>
</div>
</body>
<script type="text/javascript" src="${staticPath}/js/list.js"></script>